﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace S.EarTag.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ApolloController : ControllerBase
    {
        private readonly IConfiguration _configuration;
        public ApolloController(IConfiguration configuration)
        {
            _configuration = configuration;  
        }
        [HttpGet]
        public IActionResult SetApollo(string key)
        {
            //通过配置绑定，我们可以直接从Apollo中获取配置值
            var value=_configuration.GetValue<string>(key);
            if (value != null)
            {
                return Ok(value);
            }
            else
            {
                return NotFound();
            }
        }
    }
}
